import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

public class aaa {
    public static void main(String[] args) {
        //抓鳖 从集合中取出数据 五个人抓鳖的实现
        List<String> bie = new ArrayList<String>();
        Collections.addAll(bie,"学羊叫五声","蛙跳10个","吃芥末","喝一杯啤酒","做10个俯卧撑");
        Collections.shuffle(bie);
        List<String> students = new ArrayList<String>();
        Collections.addAll(students,"张三","李四","王五","赵六","牛七");
        Collections.shuffle(students);

        //开始使用迭代器
        Iterator<String> iterator = students.iterator();
        while (iterator.hasNext()){
            //我每次都拿到了一个人的名字 我要去抓憋
            for (int i = 0; i < bie.size(); i++) {
                //名字有了 抓别
                System.out.println(iterator.next()+"从笼子中抓到了"+bie.get(i));
                //它这个人进去了 只能抓一次 所以得删除它
                iterator.remove();
            }


        }
    }
}
